package Lib3d.SceneGraph.Impl;


import Lib3d.Vector3d;
import Lib3d.SceneGraph.Translation;

import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;

/**
 * An implementation of the translation tranformation for the scene graph child.
 * 
 * @author Wassim Chegham
 * @author Miriam Baran-Surel
 * @version 0.1
 * @category Lib3d.SceneGraphImpl
 * 
 */
public class TranslationImpl extends TransformImpl implements Translation {

    Vector3d translation;

    public TranslationImpl(final Vector3d translation) {
        this.translation = translation;
    }

    @Override
    public void draw(final GLAutoDrawable gLDrawable) {

        final GL gl = gLDrawable.getGL();
        gl.glTranslatef(this.translation.get(0), this.translation.get(1),
                this.translation.get(2));

        super.draw(gLDrawable);
    }

    public Vector3d getTranslation() {
        return this.translation;
    }

    public void setTranslation(final Vector3d translation) {
        this.translation = translation;
    }

}
